package com.gs.SynAntiWandering.dialog;

import android.content.Context;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.gs.SynAntiWandering.R;


public class ToastDialog extends BaseDialog {

    private TextView tvMsg;
    private ImageView ivIco;
    private String msg;

    private Context context;

    public ToastDialog(@NonNull Context context) {
        super(context, R.style.toast_dialog);
        this.context = context;
    }

    public ToastDialog setMessage(String msg) {
        this.msg = msg;
        return this;
    }

    @Override
    public void refreshView() {
        tvMsg.setText(msg);
        Animation anim = AnimationUtils.loadAnimation(context, R.anim.progressbar);
        anim.start();
        ivIco.startAnimation(anim);
    }

    @Override
    public void initView() {
        tvMsg = findViewById(R.id.tvMsg);
        ivIco = findViewById(R.id.ivIco);
    }

    @Override
    public int getLayoutId() {
        return R.layout.dialog_toast;
    }


}
